using UnityEngine;
using System.Collections;

public class CameraController : MonoBehaviour
{

    #region Public Fields
    public Transform Target;
    public Vector2 CameraOffset = new Vector2(4, 5);
    public float LerpTime = 10f;
    #endregion

    void Start()
    {
        if (Target == null) Debug.LogError("No Target assigned!");
    }

    void Update()
    {
        // Align X and Y axis (with offset) but keep the initial Z-distance to the player
        transform.position = Vector3.Lerp(transform.position, new Vector3(Target.position.x + CameraOffset.x, 
                                                                          Target.position.y + CameraOffset.y, 
                                                                          transform.position.z), 
                                                                          LerpTime * Time.deltaTime);
    }

}
